package eclipse.weibo.service;

import java.util.List;

import weibo4j.User;
import eclipse.weibo.util.WeiboUtil;

public class ReadUserThread extends Thread {
    private MyObservable ob;
    private String userId;
    private int i;
    private int type;

    public ReadUserThread(MyObservable ob, String userId, int i, int type) {
        this.ob = ob;
        this.userId = userId;
        this.i = i;
        this.type = type;
    }

    public void run() {
        List<User> list = null;
        if (this.type == 0) {
            if (this.i == 0) {
                list = WeiboUtil.getUserGuanzhu(this.userId, 0);
            } else if (this.i == 1) {
                list = WeiboUtil.getUserGuanzhu(this.userId, 1);
            } else if (this.i == -1) {
                list = WeiboUtil.getUserGuanzhu(this.userId, -1);
            }
        } else if (this.type == 1) {
            if (this.i == 0) {
                list = WeiboUtil.getUserFans(this.userId, 0);
            } else if (this.i == 1) {
                list = WeiboUtil.getUserFans(this.userId, 1);
            } else if (this.i == -1) {
                list = WeiboUtil.getUserFans(this.userId, -1);
            }
        }

        this.ob.notifyObservers(list);
    }
}